import http from "../../utils/requestAI";
import { type RoleByID, type roleData, type RoleForm, type RoleParams, type RolesList, type RolesListData } from "./type";

// 角色列表
export const getRoles = (params?: RoleParams) => {
    return http.get<roleData>('/role/list', params);
}

// 删除角色
export const delRole=(id:number)=>{
    console.log('删除1111',id);
    return  http.delete(`/role/delete/${id}`);
}
// 批量删除角色
export const delRoles=(ids:number[])=>{

    console.log('删除222',ids);
    return  http.post(`/role/deleteAll`,ids);
  
}

// 获取角色权限列表
export const getRoleMenu=()=>{
    return  http.get<RolesListData>('/menu/list');
}

// 角色添加
export const addRole=(data:RoleForm)=>{
    return  http.post('/role/add',data);
}

//根据id获取角色信息
export const getRoleById=(id:number)=>{
    return  http.get<RoleByID>(`/role/get/${id}`);
}